package org.obs.service.impl;

import org.obs.core.HibernateExecutor;
import org.obs.core.hibernate.operations.CreateUserByRequestOperation;
import org.obs.core.hibernate.operations.CreateUserRequestOperation;
import org.obs.service.RegistrationService;
import org.springframework.transaction.annotation.Transactional;

public class RegistrationServiceImpl implements RegistrationService {

    private HibernateExecutor executor;

    public RegistrationServiceImpl(HibernateExecutor executor) {
        this.executor = executor;
    }

    public RegistrationServiceImpl() {

    }

    public void setExecutor(HibernateExecutor executor) {
        this.executor = executor;
    }

    @Transactional
    public Boolean createUserByRequest(String n, String v) {
        return executor.execute(new CreateUserByRequestOperation(n, v));
    }

    @Transactional
    public void createUserRequest(String f, String l, String s, String n,
            String e, String p) {
        executor.execute(new CreateUserRequestOperation(n, e, p));
        // TODO: create message
    }

}
